# -*- coding: utf-8 -*-
# !/usr/bin/env python
"""
-------------------------------------------------
   File Name：     merge_video
   Description :   
   Author :       lth
   date：          2022/6/14
-------------------------------------------------
   Change Activity:
                   2022/6/14 9:26: create this script
-------------------------------------------------
"""
__author__ = 'lth'

"""
this script is used to extract the audio track from original video to the new video

"""

from moviepy.editor import *

video_clipa = VideoFileClip("art.mp4")
video_clipb = VideoFileClip("c1.mp4")

audio_a = video_clipa.audio

video_clipc = video_clipb.set_audio(audio_a)

video_clipc.write_videofile("new_c1.mp4")


class AddSoundTrack:
    @staticmethod
    def add(source, target, new_name):
        video_clipa = VideoFileClip(source)
        video_clipb = VideoFileClip(target)

        audio_a = video_clipa.audio
        video_clipc = video_clipb.set_audio(audio_a)
        video_clipc.write_videofile(new_name)


if __name__ == "__main__":
    model = AddSoundTrack()
    model.add(source="art.mp4", target="c1.mp4", new_name="new_c1.mp4")
